<%@ taglib prefix="c" uri="/WEB-INF/tlds/hdiv-c.tld"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<script>
    $(document).ready(function(){ 
        $("#dest").hide(); 
        $("#Aten").hide(); 
        $("#Hopp").hide(); 
        $("#toggleDestino").click(function(){
            $("#dest").toggle("slow");
        });
        $("#toggleAtencion").click(function(){
            $("#Aten").toggle("slow");
        });
        $("#toggleHopper").click(function(){
            $("#Hopp").toggle("slow");
        });
    });
</script>

 <table align="left" class="verdana10bazul" width="700"><tr><td>
 	<ul class="navlist2">
 	  <li>Pedidos</li>
 	</ul>
  </td></tr>
  <tr>
  <td>
  
    <table align="left" class="verdana10bazul" width="700"> 
    <tr><td><table id="cabeTable" align="left" class="verdana10bazul" width="700"><!--**********Cabecera Pedidos ATM**************-->
           <tr>
              <td width="80"></td>
              <th align="left" height="25" class="verdana10bazul" width="120">Nro de Pedido</th>
              <td height="25" align="left" class="verdana10bazul" width="300">${pedidoSelected.codSeriPedi} - ${pedidoSelected.numPedi} </td>
          </tr>
	      <c:if  test="${sessionScope.tipClie eq sessionScope.TIPO_CLIENTE_CORPORACION}">
             <tr>
                    <td width="80"></td>
                    <th align="left" height="25" class="verdana10bazul" width="120">Corporaci&oacute;n</th>
                    <td height="25" align="left" class="verdana10negro" width="300">
                        <c:out value="${sessionScope.desCorp}"/>
                    </td>
            <th align="left" height="25" class="verdana10bazul" width="150">&nbsp;</th>
                    <td height="25" align="left" class="verdana10negro" width="300">&nbsp;</td>
                 </tr>
          </c:if> 	 
           <tr>
		    
		   
              <td width="80"></td>
              <th align="left" height="25" class="verdana10bazul" width="120">Cliente</th>
              <td height="25" align="left" class="verdana10negro" width="300">
                <c:if  test="${sessionScope.tipClie != sessionScope.TIPO_CLIENTE_CORPORACION}">
                  <c:out value="${sessionScope.nombreCliente}"/>
               </c:if>   
              
              <c:if  test="${sessionScope.tipClie == sessionScope.TIPO_CLIENTE_CORPORACION}">
                  <c:out value="${pedidoSelected.clieGrup.nomClie}"/>
              </c:if>   
               
               
              </td>
			<th align="left" height="25" class="verdana10bazul" width="150">Tipo de Documento</th>
            	<td height="25" align="left" class="verdana10negro" width="300">${pedidoSelected.tipDocuPedi}</td>
	         </tr>
          <tr>
            <td width="80"></td>
            <th align="left" height="25" class="verdana10bazul" width="120">Tipo de Pedido</th>
            <td height="25" align="left" class="verdana10negro" width="300"> ${pedidoSelected.tipPedi.desTipo}</td>
            
            <th align="left" height="25" class="verdana10bazul" width="150">Tipo de Billetaje</th>
            <td height="25" align="left" class="verdana10negro" width="300">${pedidoSelected.billetaje.desTipo}</td>
          </tr>
          <tr>
            <td width="80"></td>
            <th align="left" height="25" class="verdana10bazul" width="120">Fecha Solicitud</th>
            <td height="25" align="left" class="verdana10negro" width="300">${pedidoSelected.fecSoliPedi}</td>
            
            <th align="left" height="25" class="verdana10bazul" width="150">Cuenta</th>
            <td height="25" align="left" class="verdana10negro" width="300">${pedidoSelected.cuentaOrig.codCnta} - ${pedidoSelected.cuentaOrig.desCnta}</td>
          </tr>
          <tr>
            <td width="80"></td>
            <th align="left" height="25" class="verdana10bazul" width="120">Hora Solicitud</th>
            <td height="25" align="left" class="verdana10negro" width="300">${pedidoSelected.horSoliPedi}</td>
			<th align="left" height="25" class="verdana10bazul" width="120">Estado</th>
            <td height="25" align="left" class="verdana10negro" width="300">${pedidoSelected.estado}</td>
          </tr>
          <tr>
            <td width="80"></td>
            <th align="left" height="25" class="verdana10bazul" width="120">Cliente Origen</th>
            <td height="25" align="left" class="verdana10negro" width="300">${pedidoSelected.clieOrig.nomClie}</td>
          </tr>
    </table></td></tr>
    
       <tr><th><img src="images/destinoIcon.png" align="left" alt="Destino" id="toggleDestino"/></th></tr>    
       <tr><td>
          <table border="1" cellspacing="0" cellpadding="0" id="dest" width="700"><tr><td>
          <table align="left" class="verdana10bazul" > <!--**********Inicio Destino**************-->
            <tr>
              <td width="80"></td>

              <th align="left" height="25" width="160">C&oacute;digo Agencia </th>
              <td height="25" align="left" width="300" class="verdana10negro">${pedidoSelected.punt.codPunt}</td>
            </tr>
            <tr>
              <td width="80"></td>
              <th align="left" height="25" width="90">Descripc&iacute;on </th>
              <td height="25" align="left" class="verdana10negro" width="320">${pedidoSelected.punt.desPunt}</td>
            </tr>
            <tr>
              <td width="80"></td>
              <th align="left" height="25" width="90">Direcci&oacute;n</th>
              <td height="25" align="left" class="verdana10negro" width="320">${pedidoSelected.punt.desDirePunt}</td>
            </tr>
         </table>
     </td></tr></table>
      </td></tr><!--**********Fin Destino**************-->
      
      <tr><th><img src="images/atencionIcon.png" align="left" alt="Atencion" id="toggleAtencion"/></th></tr>
      <tr><td>
      <table border="1" cellspacing="0" cellpadding="0" id="Aten" width="700"><tr><td>
      <table align="left" class="verdana10bazul"> <!--**********Inicio Atencion**************-->
      <tr>
          <td width="80"></td>
          <th align="left" height="25" width="150">Fecha de Atenci&oacute;n</th>
          <td height="25" align="left" class="verdana10negro" width="260">${pedidoSelected.fecAtenPedi}</td>
          <th align="left" height="25" width="150">Hora Inicio</th>
          <td height="25" align="left" class="verdana10negro" width="310">${pedidoSelected.horAtenInicPact}</td>
      </tr>
      <tr>
          <td width="80"></td>     
          <th align="left" height="40" width="150">Estado del Pedido</th>
          <td width="260"></td>
          <td width="150"></td>
          <td width="310"></td>
      </tr>
      <tr align="center">
      
         <td colspan="5" align="center">
         <table id="estadoPedido" class="verdana10bazul its7" align="center">
         <thead>
            <tr>
               <th  width="30" align="center">Nivel</th>
               <th  width="150" align="center">Responsable</th>
               <th width="80" align="center">Estado</th>
               <th width="80" align="center">Fecha Aprobaci&oacute;n</th>
               <th width="200" align="center">Observaci&oacute;n</th>
            </tr>
         </thead>
         <tbody>
            <c:forEach items="${listEstPedido}" varStatus="status" var="estPedi"> 
              <tr class="saved">
                <td width="30" align="center">${estPedi.numNivel}</td>
                <td width="150" align="center">${estPedi.desNivel}</td>
                <td width="80"  align="center">${estPedi.desTipo}</td>
                <td width="80"  align="center">${estPedi.fecModi}</td>
                <td width="200" align="center">${estPedi.observ}</td>
              </tr>
            </c:forEach>
         </tbody>
         </table>         </td>
      </tr>
      </table>
      </td></tr></table>
      </td></tr><!--**********Fin Atencion**************-->
      
       <tr><th><img src="images/detalleHopperIcon.png" align="left" alt="Detalle por Hopper" id="toggleHopper"/></th></tr>
       <tr><td>
       <table border="1" cellspacing="0" cellpadding="0" id="Hopp" width="700"><tr><td>
       <table align="center" class="verdana10bazul"> <!--**********Inicio Hopper**************-->
       <tr>
         <td>
         <!--iterando unidades monetarias -->
         <c:forEach items="${listUnidMone}" var="uniMone">
          	<c:if test="${pageContext.request.method=='GET' || pageContext.request.method=='POST' }">
            <c:choose>
             <c:when test="${uniMone.codigo == 1 }">
              <c:set var="listDeno" value="${listDenoDolares}"/>  
             </c:when>
              <c:when test="${uniMone.codigo == 2 }">
              <c:set var="listDeno" value="${listDenoSoles}"/>  
             </c:when>
            </c:choose>
          </c:if>
            ${uniMone.descripcion}
             <table width="100%" border="0">
               <tr>
                 <td> Montos por Denominaci&oacute;n </td>
                 <td><table  class="verdana10bazul its7" align="center">
                   <thead>
                     <tr>
                       <c:forEach items="${listDeno}" var="deno">
                         <th  width="30"  align="center"> <c:if test="${pageContext.request.method=='GET' || pageContext.request.method=='POST' }">
                             <c:choose>
                               <c:when test="${deno.tipoDenominacion >=1}">
                                 <fmt:formatNumber value="${deno.tipoDenominacion}" pattern="###,###,###,##0"/>
                               </c:when>
                               <c:otherwise>
                                 <fmt:formatNumber value="${deno.tipoDenominacion}" pattern="###,###,###,##0.00"/>
                               </c:otherwise>
                             </c:choose>
                           </c:if>
                         </th>
                       </c:forEach >
                     </tr>
                   </thead>
                   <tbody>
                     <tr class="saved">
                       <c:forEach items="${listDenoSoles}" var="denoTot">
                          <c:set var="montoDeno" value="0" />
                         <td width="30"  align="center">
                           <c:forEach items="${pedidoSelected.denosDetaPedido}" var="denoDeta">
                             <c:if test="${denoTot.tipoDenominacion eq denoDeta.deno.canValoNomi && denoDeta.unidMone.codTipo eq uniMone.codigo }">
                                <c:set var="montoDeno" value="${denoDeta.montDeno}" />
                             </c:if>
                           </c:forEach>
                           <fmt:formatNumber value="${montoDeno}" pattern="###,###,###,##0.00"/>
                         </td>
                       </c:forEach>
                     </tr>
                   </tbody>
                 </table></td>
               </tr>
             </table>
             </c:forEach>         </td>
      </tr>
      <tr>
          <th align="left" height="40">Total x Unidad Monetaria</th>
      </tr>
      <tr> 
         <td>
         <table id="totUnidMone" class="verdana10bazul its7" align="center">
         <thead>
            <tr>
               <th  width="100"  align="center">UM</th>
               <th  width="100"  align="center">Monto Total</th>
            </tr>
         </thead>
         <tbody>
         <c:forEach items="${listUnidMone}" var="unidMoned" >
            <c:set var="montDeno" value="0"/>
            <c:forEach items="${pedidoSelected.denosDetaPedido}" var="denoDetaTotal"> 
                 <c:if test="${unidMoned.codigo == denoDetaTotal.unidMone.codTipo}">
                       <c:set var="montDeno" value="${montDeno+denoDetaTotal.montDeno}"/>  
                 </c:if>
            </c:forEach>  
            
            <tr class="saved">
                <td width="100"  align="center">${unidMoned.descripcion}</td>
                <td width="100"  align="center"><fmt:formatNumber value="${montDeno}" pattern="###,###,###,##0.00"/></td>
            </tr>
         </c:forEach>     
              
            
         </tbody>
         </table>
         </td>
      </tr>
      </table>
      </td></tr></table>
      </td></tr> <!--**********Fin Hopper**************-->
    
    </table>
   </td>
  
 </tr>
 </table>
 